﻿using System;
using System.IO.Ports;

// ReSharper disable CheckNamespace
namespace Eric.SerialPorts
// ReSharper restore CheckNamespace
{
    /// <summary>
    /// Interface defination of serial wrapper in DIH.
    /// </summary>
    public interface ISerialPortWrapper : IDisposable
    {
        #region Members
        ISerialPortParameter PortParameter { get; }
        bool IsOpen { get; }
        #endregion

        #region Public Methods
        void Open();
        void Close();
        void DiscardInAndOutBuffer();
        void Send(byte[] bytes);
        void Send(byte[] bytes, int startIndex, int length);
        #endregion

        #region Event
        event EventHandler<SerialPortWrapperDataEventArgs> BizCommandReceivedEvent;
        event EventHandler<SerialErrorReceivedEventArgs> ErrorReceived;
        #endregion

    }
}
